home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
boe.pres.k12.wv.us
/
boe.pres.k12.wv.us.zip
/
boe.pres.k12.wv.us
/
Utilities
/
Xerox Workcentre 5335
/
Windows Scan
/
64-bit_x64
/
Russian
/
cpsimage.cab
/
data
/
sys
/
lang.elf
< prev
next >
Wrap
Text File
|
2009-04-23
|
9KB
|
172 lines
/*
** $Id: lang.elf,v 1.11 2009/04/22 14:35:18 pemmett Exp $
*/
/******************************************************************************/
/*
** This class provides progamatic access to the language.
*/
/* @listClasses Returns a list of the current class type names. */
/* @listProcedures Returns a list of the currently defined procedure names. */
/* @listGlobals Returns a list of the currently defined global variable names. */
/* @listLocals Returns a list of the currently defined local variable names. */
/* @findClass Returns a CLASSREF object describing the given class. */
/* @findProcedure Returns a CALLREF object describing the given procedure. */
/* @findVariable Returns a STRING describing the type of the given variable. */
/* @hasClass Does the given class exist. */
/* @hasProcedure Does the given procedure exist. */
/* @hasVariable Does the given variable exist. */
/* @invokeProcedure Call the named procedure with the params given. Returns a LIST of the returns. */
/* @setVariable Sets the named variable to the value given. */
/* @getVariable Gets the named variable. */
/* @New
// DESCRIPTION
Creates a new instance of a REFLECTION object. This object can be used to
progamatically access features of the language. This includes the available classes,
procedures, local variables and global variables.
// EXAMPLE's
#load "sys/lang.elf";
LIST classes = REFLECTION.listClasses();
print classes;
IMPORT STRING procname = "myproc";
if( REFLECTION.hasProcedure( name:procname ) ) {
REFLECTION.invokeProcedure( name:procname );
}
*/
/******************************************************************************/
CLASS REFLECTION {
/* Static Methods */
METHOD New() RETURNS( REFLECTION obj ) NATIVE "ElfReflectMethods@builtins";
METHOD listClasses() RETURNS( LIST list ) NATIVE "ElfReflectMethods@builtins";
METHOD listProcedures() RETURNS( LIST list ) NATIVE "ElfReflectMethods@builtins";
METHOD listGlobals() RETURNS( LIST list ) NATIVE "ElfReflectMethods@builtins";
METHOD listLocals() RETURNS( LIST list ) NATIVE "ElfReflectMethods@builtins";
METHOD findClass( STRING name ) RETURNS( CLASSREF ref ) NATIVE "ElfReflectMethods@builtins";
METHOD findProcedure( STRING name ) RETURNS( CALLREF ref ) NATIVE "ElfReflectMethods@builtins";
METHOD findVariable( STRING name ) RETURNS( STRING ref ) NATIVE "ElfReflectMethods@builtins";
METHOD hasClass( STRING name ) RETURNS( BOOLEAN val ) NATIVE "ElfReflectMethods@builtins";
METHOD hasProcedure( STRING name ) RETURNS( BOOLEAN val ) NATIVE "ElfReflectMethods@builtins";
METHOD hasVariable( STRING name ) RETURNS( BOOLEAN val ) NATIVE "ElfReflectMethods@builtins";
METHOD invokeProcedure( STRING name, LIST params ) RETURNS( LIST results ) NATIVE "ElfReflectMethods@builtins";
METHOD getVariable( STRING name ) RETURNS( OBJECT value ) NATIVE "ElfReflectMethods@builtins";
METHOD setVariable( STRING name, OBJECT value ) NATIVE "ElfReflectMethods@builtins";
}
/******************************************************************************/
/*
** This class provides progamatic access to a method or procedure.
*/
/* @getName Returns the procedure or method name. */
/* @listParameters Returns a named LIST with the names and type names of the parameters. */
/* @listReturns Returns a named LIST with the names and type names of the returns. */
/******************************************************************************/
CLASS CALLREF {
METHOD Empty() RETURNS( BOOLEAN empty ) NATIVE "ElfCallRefMethods@builtins";
METHOD getName() RETURNS( STRING name ) NATIVE "ElfCallRefMethods@builtins";
METHOD listParameters() RETURNS( LIST list ) NATIVE "ElfCallRefMethods@builtins";
METHOD listReturns() RETURNS( LIST list ) NATIVE "ElfCallRefMethods@builtins";
/* Private Fields */
VOID handle;
}
/******************************************************************************/
/*
** This class provides progamatic access to the language.
*/
/* @getName Returns the class type name. */
/* @isInstance Is the given object an instance of this class type. */
/* @isAssignableFrom Is the given class a subclass of this class type. */
/* @listFields Returns a LIST of the field names. */
/* @listMethods Returns a LIST of the method names. */
/* @findMethod Returns a CALLREF object describing the given method. */
/* @hasMethod Does the given method exists. */
/* @hasField Does the given field exists. */
/* @newInstance Creates a new instance of this class type with the given params. */
/* @invokeMethod Class the named method the given params. Obj may be omitted if this CLASSREF refers to a given obj. See New. */
/* @getField Gets the value of the named field. Obj may be omitted if this CLASSREF refers to a given obj. See New. */
/* @setField Sets the value of the named field. Obj may be omitted if this CLASSREF refers to a given obj. See New. */
/* @New
// DESCRIPTION
Creates a new instance of a CLASSREF object. This object can be used to
progamatically access information about a class. This includes the available
methods, fields and the constructor. A given object may be inspected or the
class type may be inspected when created with the REFLECTION.findClass call.
// ARGUMENTS
OBJECT handle An object to inspect.
// EXAMPLE's
#load "sys/lang.elf";
IMPORT STRING classname = "myclass";
// Inspect the class type
CLASSREF cr = REFLECTION.findClass( name:classname );
OBJECT obj = cr.newInstance(); // no params
LIST list = ( filename:"foo", compression:1 );
cr.invokeMethod( obj:obj, name:"magic", params:list );
// Inspect a given object.
CLASSREF ncr = new(CLASSREF, handle:obj);
LIST methods = ncr.listMethods();
print methods;
*/
/******************************************************************************/
CLASS CLASSREF {
METHOD New( OBJECT handle ) RETURNS( CLASSREF obj ) NATIVE "ElfClassRefMethods@builtins";
METHOD Empty() RETURNS( BOOLEAN empty ) NATIVE "ElfClassRefMethods@builtins";
METHOD getName() RETURNS( STRING name ) NATIVE "ElfClassRefMethods@builtins";
METHOD isInstance( OBJECT obj ) RETURNS( BOOLEAN val ) NATIVE "ElfClassRefMethods@builtins";
METHOD isAssignableFrom( CLASSREF cls ) RETURNS( BOOLEAN val ) NATIVE "ElfClassRefMethods@builtins";
METHOD listMethods() RETURNS( LIST methods ) NATIVE "ElfClassRefMethods@builtins";
METHOD listFields() RETURNS( LIST fields ) NATIVE "ElfClassRefMethods@builtins";
METHOD findMethod( STRING name ) RETURNS( CALLREF ref ) NATIVE "ElfClassRefMethods@builtins";
METHOD hasMethod( STRING name ) RETURNS( BOOLEAN val ) NATIVE "ElfClassRefMethods@builtins";
METHOD hasField( STRING name ) RETURNS( BOOLEAN val ) NATIVE "ElfClassRefMethods@builtins";
METHOD newInstance( LIST params ) RETURNS( OBJECT obj ) NATIVE "ElfClassRefMethods@builtins";
/* Static Methods */
METHOD invokeMethod( OBJECT obj, STRING name, LIST params ) RETURNS( LIST results ) NATIVE "ElfClassRefMethods@builtins";
METHOD getField( OBJECT obj, STRING name) RETURNS( OBJECT value ) NATIVE "ElfClassRefMethods@builtins";
METHOD setField( OBJECT obj, STRING name, OBJECT value ) NATIVE "ElfClassRefMethods@builtins";
/* Private Fields */
OBJECT handle;
}
/******************************************************************************/
/*
** This class provides progamatic access to the debugger.
*/
/* @attach Attaches current execution to a debugger. Can be done only once. NOTE: this method
is still very experimental and is really not working. Do not play with this unless you know what
you are doing.
*/
/* @isDebugging Is the current execution attached to a debugger. */
/* @log Logs a message to the active debugger. Is a no op if no debugger is attached. */
/* @printStackTrace Prints the current stack trace, does not have to be attached to work. */
/******************************************************************************/
private
CLASS DEBUGGER {
/* Static Methods */
METHOD attach( STRING url ) NATIVE "ElfDebuggerMethods@builtins";
METHOD isDebugging() RETURNS( BOOLEAN isdebug ) NATIVE "ElfDebuggerMethods@builtins";
METHOD log( STRING msg ) NATIVE "ElfDebuggerMethods@builtins";
METHOD printStackTrace() NATIVE "ElfDebuggerMethods@builtins";
}